Previous: Logarithmic Units, Up: Units [Contents][Index]
Calc can convert between musical notes and their associated frequencies. Notes can be given using either scientific pitch notation or midi numbers. Since these note systems are basically logarithmic scales, Calc uses the l prefix for functions operating on notes.
Scientific pitch notation refers to a note by giving a letter A through G, possibly followed by a flat or sharp) with a subscript indicating an octave number. Each octave starts with C and ends with B and the octave numbered 0 was chosen to correspond to the lowest audible frequency. Using this system, middle C (about 261.625 Hz) corresponds to the note ‘C’ in octave 4 and is denoted ‘C_4’. Any frequency can be described by giving a note plus an offset in cents (where a cent is a ratio of frequencies so that a semitone consists of 100 cents).
The midi note number system assigns numbers to notes so that ‘C_(-1)’ corresponds to the midi note number 0 and ‘G_9’ corresponds to the midi note number 127. A midi controller can have up to 128 keys and each midi note number from 0 to 127 corresponds to a possible key.
The l s (calc-spn) [spn]
command converts either a frequency or a midi number to
scientific pitch notation. For example, 500 Hz gets
converted to B_4 + 21.3094853649 cents and
84 to C_6.
The l m (calc-midi)
[midi] command converts either a frequency or a note
given in scientific pitch notation to the corresponding midi
number. For example, C_6 gets converted to 84 and
440 Hz to 69.
The l f (calc-freq)
[freq] command converts either either a midi number
or a note given in scientific pitch notation to the corresponding
frequency. For example, Asharp_2 + 30 cents gets
converted to 118.578040134 Hz and 55 to
195.99771799 Hz.
Since the frequencies of notes are not usually given exactly
(and are typically irrational), the customizable variable
calc-note-threshold determines how close (in cents)
a frequency needs to be to a note to be recognized as that note
(see Customizing
Calc). This variable has a default value of 1.
For example, middle C is approximately
‘261.625565302 Hz’; this frequency is
often shortened to ‘261.625 Hz’. Without
calc-note-threshold (or a value of
‘0’), Calc would convert 261.625
Hz to scientific pitch notation B_3 + 99.9962592773
cents; with the default value of 1, Calc
converts 261.625 Hz to C_4.
Previous: Logarithmic Units, Up: Units [Contents][Index]